using System;
using System.Collections.Generic;
using System.Text;

namespace RapidHDL.PipeLine
{

    public class BufferStage : StageRegister 
    {

        public PipelineStage PipeLineSync;
        public ResetReg DataRegister;


        ClockComponent oClock;

        public BufferStage(Component poParentComponent, string psName, ClockComponent poClock, NodeVector poReset, int piWidth)
            : base(poParentComponent, psName,piWidth,poClock,poReset)
        {
            oClock = poClock;
            //PipeLineSync = new PipeLineSync(this, "pipe_sync", oClock, poReset);
            DataRegister = new ResetReg(this, "data_reg", oClock, piWidth, true, true, false);            
        }

        public void LinkDownstreamPipe(PipelineStage poPipeSync)
        {
            poPipeSync.OutputStall.Join(PipeLineSync.InputStall);
            poPipeSync.InputDataReady.Join(PipeLineSync.OutputDataReady);
        }

        public override void GenerateStructure()
        {
            NodeVector nvEnableStalled = this.CreateNodeVector("enable_stalled",1);
            NodeVector nvEnableNotStalled = this.CreateNodeVector("enable_not_stalled", 1);

            //nvEnableStalled.Join(PipeLineSync.OutputDataReady & PipeLineSync.
             

        }
    }
}
